/****************************************************************************
*                                                                           *
* mainwindow.h -- main window of the simulator								*
*                                                                           *
* ALaRI 2008												                *
*                                                                           *
****************************************************************************/
#if !defined(__MAINWINDOW_H)
#define __MAINWINDOW_H

/****************************************************************************
* Includes                                                                  *
****************************************************************************/

#include <QMainWindow>
#include <QtGui>
#include "../../core/prop/scatter.h"
#include "floor.h"
#include "simarea.h"
#include "../dialogs/settings.h"
#include "../dialogs/drawdialog.h"

/****************************************************************************
* Forward declarations                                                      *
****************************************************************************/

/****************************************************************************
* CMainWindow - main window of the application					 			*
****************************************************************************/
class CMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    /****************************************************************************
	* Construction/Destruction                                                  *
	****************************************************************************/
	CMainWindow(const char *name = 0, Qt::WindowFlags flags = 0);
	~CMainWindow();

protected:
    void closeEvent(QCloseEvent *event);

	/****************************************************************************
	* Private slots				                                                *
	****************************************************************************/
private slots:
	void createNewFloorPlan();
	void startSimulation();
	void finishSimulation();
	void cancelSimulation();
	void selectMaterial(const QString&);
	void selectSensor(QListWidgetItem *pItem);
	void updateSensorList();
	void onSettings();
	void onDrawSpecial();
	void exportGraphToGraphViz();

private:
    /****************************************************************************
	* Private workers															*
	****************************************************************************/
	void createActions();
	void createDialogs();
	void createMenus();
	void createToolbars();
	void createMainWindow();
	void createDockWidgets();
	void initSimulator();

    /****************************************************************************
	* Private GUI data															*
	****************************************************************************/
	// floor
	CFloorWidget			m_qWidgetFloor;
	QSimWidget				m_qWidgetSim;
	// drawing actions
	QAction					*m_pActionDrawWall;
	QAction					*m_pActionDrawRoom;
	QAction					*m_pActionDrawRound;
	QAction					*m_pActionDrawSpecial;
	QAction					*m_pActionIdle;
	QAction					*m_pActionPutSensor;
	QActionGroup			*m_pActionGroupDraw;
	// simulation actions
	QAction					*m_pQActionSimulate;
	QAction					*m_pQActionExportGraphToGraphViz;
	// settings actions
	QAction					*m_pQActionSettings;

	// application actions
	QAction					*m_pActionClose;
	QAction					*m_pActionNewFloor;
	QAction					*m_pActionOpen;
	QAction					*m_pActionSave;
	// toolbars
	QToolBar				*m_pDrawToolbar;
	QToolBar				*m_pCreateToolbar;
	QToolBar				*m_pSimToolbar;
	// tabs
	QTabWidget				*m_pTabs;
	//menus
	QMenu					*m_pQMenuFile;
	QMenu					*m_pQMenuView;
	QMenu					*m_pQMenuSimulate;
	QMenu					*m_pQMenuGeometry;
	// material combobox
	QComboBox				*m_pMaterialComboBox;
	// pen width spinbox
	QSpinBox				*m_pPenWidthSpinBox;
	// material list 
	QListWidget				*m_pQListWidgetMaterials;
	QListWidget				*m_pQListWidgetSensors;
	//dialogs 
	CSettingsDialog			*m_pSettingsDialog;
	QProgressDialog			*m_pProgressDlg;
	CDrawDialog				*m_pDrawSpecialDialog;

	/****************************************************************************
	* Private data																*	
	****************************************************************************/
	QImage					m_qImageFloor;
	CScatSimulator			*m_pPropagationSim;
//	CNetworkSimulator		*m_pNetworkSim;
};

#endif /* __MAINWINDOW_H */
